package conf

import (
	"encoding/json"
	"io/ioutil"
)

var Conf struct{
	DriverPort int
	MySqlDb string
	DouYinAcount []struct{
		UserName	string
      	PassWord	string
      	UserName2	string
      	PassWord2	string
		Company		string
		DouYinCookie		string
	}
}

func LoadConfig(file string) error {
	data, err := ioutil.ReadFile(file)
	if err != nil {
		return err
	}
	err = json.Unmarshal(data, &Conf)
	if err != nil {
		return err
	}
	return nil
}

func init() {
	if err := LoadConfig("conf.json"); err != nil {
		panic(err)
	}
}